<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹性盒子的收缩比率</title>
    <style>
        body{
            margin: 0;
            padding: 0;
        }
        .box{
            margin: 0 auto;
            width: 400px;
            height: 400px;
            margin-top: 100px;
            background-color: bisque;
            list-style-type: none;
            padding: 0;
            overflow:hidden;
            display: -webkit-flex;  
            display: flex;
            flex-direction: row;
            /* flex-wrap: wrap; */
            justify-content: space-around;
            align-items: flex-start;
        }
        .row{
            width: 100px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            margin-top: 10px;
            background-color: rgb(102, 240, 203);
        }
        #item1{
            background-color: red;
            width: 100px;
             /* 收缩比率，默认值为1 */
            flex-shrink: 1; 
        }
        #item2{
            background-color: rgb(124, 111, 237);
            width: 200px;
            flex-shrink: 2;
        }
        #item3{
            background-color: rgb(241, 96, 200);
            width: 300px;
            flex-shrink: 3;
        }
    </style>
</head>
<body>
    <div>
        <!-- 元素收缩空间公式：
            1、多出来的尺寸  200px
            2、总权重：元素1的尺寸*收缩比率+元素2的尺寸*收缩比率……   1*100 + 2*200 + 3*300 = 1400px
            3、收缩空间：元素尺寸*收缩比率*多出来的尺寸/总权重   #item1: 100*1*200/1400 = 14.285……
            3、收缩后的空间：元素尺寸 - 收缩空间  #item1: 100 - 14.285 = 85.714…… -->
        <ul class="box">
            <li id="item1" class="row">弹性盒子1</li>
            <li id="item2" class="row">弹性盒子2</li>
            <li id="item3" class="row">弹性盒子3</li>
        </ul>
    </div>
</body>
</html>